package us.icitap.timsportal.entity;

import us.icitap.timsportal.entity.Module;
import java.io.Serializable;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.Date;
import javax.persistence.*;

/**
 * Entity implementation class for Entity: PortalSession
 *
 */
@Entity
@Table(schema="TIMSPORTAL", name="PORTAL_SESSION")
@SequenceGenerator(name = "portal_session_seq", sequenceName = "TIMSPORTAL.SQ_TIMSPORTAL_PORTAL_SESSION", allocationSize = 1)
public class PortalSession implements Serializable {

	   
	/**
	 * 
	 */
	private static final long serialVersionUID = -8972841681058576969L;

	@Id
	@GeneratedValue(generator="portal_session_seq")
	private Integer id;
	
	@Column(name="PORTAL_SESSION_ID")
	private String portalSessionId;
	private String username;
		
	@Column(name="PORTAL_ENTRY_TIME")
	@Temporal(TemporalType.TIMESTAMP)
	private Date portalEntryTime;
	
	@Column(name="PREVIOUS_PORTAL_SESSION_ID")
	private String previousPortalSessionId;	

	@ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.MERGE})
	@JoinColumn(name="MODULE_ID")
	private Module module;
	
	@Column(name="MODULE_SESSION_ID")
	private String moduleSessionId;
	
	@Column(name="MODULE_ENTRY_TIME")
	@Temporal(TemporalType.TIMESTAMP)
	private Date moduleEntryTime;
	
	@Column(name="MODULE_ENTRY_SUCCESS")
	private Boolean moduleEntrySuccess;

	public PortalSession() {
		super();
	}   
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}   
	public String getPortalSessionId() {
		return this.portalSessionId;
	}

	public void setPortalSessionId(String portalSessionId) {
		this.portalSessionId = portalSessionId;
	}   
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}   
	public Module getModule() {
		return this.module;
	}

	public void setModule(Module module) {
		this.module = module;
	}   
	public Date getPortalEntryTime() {
		return this.portalEntryTime;
	}

	public void setPortalEntryTime(Date portalEntryTime) {
		this.portalEntryTime = portalEntryTime;
	}   
	public Date getModuleEntryTime() {
		return this.moduleEntryTime;
	}

	public void setModuleEntryTime(Date moduleEntryTime) {
		this.moduleEntryTime = moduleEntryTime;
	}   
	public Boolean getModuleEntrySuccess() {
		return this.moduleEntrySuccess;
	}

	public void setModuleEntrySuccess(Boolean moduleEntrySuccess) {
		this.moduleEntrySuccess = moduleEntrySuccess;
	}   
	public String getPreviousPortalSessionId() {
		return this.previousPortalSessionId;
	}

	public void setPreviousPortalSessionId(String previousPortalSessionId) {
		this.previousPortalSessionId = previousPortalSessionId;
	}   
	public String getModuleSessionId() {
		return this.moduleSessionId;
	}

	public void setModuleSessionId(String moduleSessionId) {
		this.moduleSessionId = moduleSessionId;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((module == null) ? 0 : module.hashCode());
		result = prime
				* result
				+ ((moduleEntrySuccess == null) ? 0 : moduleEntrySuccess
						.hashCode());
		result = prime * result
				+ ((moduleEntryTime == null) ? 0 : moduleEntryTime.hashCode());
		result = prime * result
				+ ((moduleSessionId == null) ? 0 : moduleSessionId.hashCode());
		result = prime * result
				+ ((portalEntryTime == null) ? 0 : portalEntryTime.hashCode());
		result = prime * result
				+ ((portalSessionId == null) ? 0 : portalSessionId.hashCode());
		result = prime
				* result
				+ ((previousPortalSessionId == null) ? 0
						: previousPortalSessionId.hashCode());
		result = prime * result
				+ ((username == null) ? 0 : username.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PortalSession other = (PortalSession) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (module == null) {
			if (other.module != null)
				return false;
		} else if (!module.equals(other.module))
			return false;
		if (moduleEntrySuccess == null) {
			if (other.moduleEntrySuccess != null)
				return false;
		} else if (!moduleEntrySuccess.equals(other.moduleEntrySuccess))
			return false;
		if (moduleEntryTime == null) {
			if (other.moduleEntryTime != null)
				return false;
		} else if (!moduleEntryTime.equals(other.moduleEntryTime))
			return false;
		if (moduleSessionId == null) {
			if (other.moduleSessionId != null)
				return false;
		} else if (!moduleSessionId.equals(other.moduleSessionId))
			return false;
		if (portalEntryTime == null) {
			if (other.portalEntryTime != null)
				return false;
		} else if (!portalEntryTime.equals(other.portalEntryTime))
			return false;
		if (portalSessionId == null) {
			if (other.portalSessionId != null)
				return false;
		} else if (!portalSessionId.equals(other.portalSessionId))
			return false;
		if (previousPortalSessionId == null) {
			if (other.previousPortalSessionId != null)
				return false;
		} else if (!previousPortalSessionId
				.equals(other.previousPortalSessionId))
			return false;
		if (username == null) {
			if (other.username != null)
				return false;
		} else if (!username.equals(other.username))
			return false;
		return true;
	}
   
}
